/**
 * Copyright (c) 2022 Beijing Jiaotong University
 * PhotLab is licensed under [Open Source License].
 * You can use this software according to the terms and conditions of the [Open Source License].
 * You may obtain a copy of [Open Source License] at: [https://open.source.license/]
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 *
 * See the [Open Source License] for more details.
 *
 * Author: Qing'ao Zhang
 * Created: Mar. 27, 2023
 * Supported by: National Key Research and Development Program of China
 */

import { Disposable } from "@/common/disposable"
import { commandManager } from "@/common/cmd/manager"
import { ipcRenderer } from "electron"

export const photAnalyzeManager = new class PhotAnalyzeManager extends Disposable {
    constructor() {
        super()
        return
    }

    public activate() {
        commandManager.registerCommand("photAnalyze.open", this.open)
        commandManager.registerCommand("photAnalyze.close", this.close)
        return
    }

    public async open() {
        console.log("open phot analyze window")
        ipcRenderer.send('control', 'new-win', 'PhotAnalyze')
        return
    }

    public async close() {
        console.log("close phot analyze window")
        ipcRenderer.send('child-PhotAnalyze', 'close')
        return
    }
}